<html>
<head><meta charset="utf-8"><title>CodeLens Range · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html">CodeLens Range</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="184166535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184166535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Martin Asquino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184166535">(Dec 24 2019 at 12:25)</a>:</h4>
<p>Hi everyone! Not sure how critical this is or why this is the case, but I noticed that the LSP specification says that CodeLens ranges should span a single line (<a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#textDocument_codeLens" target="_blank" title="https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#textDocument_codeLens">https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#textDocument_codeLens</a>) but some of the ones I get span multiple lines. For example this one:</p>
<p><code> CodeLens { range: Range { start: Position { line: 16, character: 0 }, end: Position { line: 23, character: 1 } }, command: Some(Command { title: "Run", command: "rust-analyzer.runSingle", arguments: Some([Object({"args": Array([String("run")]), "bin": String("cargo"), "cwd": Null, "env": Object({"RUST_BACKTRACE": String("short")}), "label": String("run binary"), "range": Object({"end": Object({"character": Number(1), "line": Number(23)}), "start": Object({"character": Number(0), "line": Number(16)})})})]) }), data: None }</code></p>
<p>Is this intended? Or should I open an issue?</p>
<p>(Also, and completely off-topic, I just saw a couple of days ago some mentions re: migration to LSP 3.15 and the lsp-types crate PR which updated it to 3.15, sorry for the mistakes in that PR, I know there were some fixes around that, and also for not being available to fix them, I just relocated to London about a month ago and I'm just starting to get things back to normal now)</p>



<a name="184171061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184171061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184171061">(Dec 24 2019 at 14:02)</a>:</h4>
<p><span class="user-mention" data-user-id="246514">@Martin Asquino</span>  Hm... I forgot about the 'one line' think. I think you should ask for clarification on <a href="https://github.com/Microsoft/language-server-protocol/" target="_blank" title="https://github.com/Microsoft/language-server-protocol/">https://github.com/Microsoft/language-server-protocol/</a></p>



<a name="184171138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184171138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184171138">(Dec 24 2019 at 14:04)</a>:</h4>
<p>No worries on the 3.15. It happens and I've made more than my share of mistakes there.</p>



<a name="184171149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184171149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184171149">(Dec 24 2019 at 14:04)</a>:</h4>
<p>I wish there was a way to autogenerate rust from the protocol spec.</p>



<a name="184176487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184176487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Martin Asquino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184176487">(Dec 24 2019 at 15:57)</a>:</h4>
<p>On a related note: I'm getting different results in the same project when running 1.39 vs 1.40. 1.39 gives me some CodeLens items back, while 1.40 gives me <code>None</code>. Maybe this one does deserve an issue? Or is it a known one already?</p>



<a name="184176650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184176650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Martin Asquino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184176650">(Dec 24 2019 at 16:00)</a>:</h4>
<p>And project is an over-statement, it's a just dummy project with only a few lines to test stuff out. <span aria-label="grinning face with smiling eyes" class="emoji emoji-1f601" role="img" title="grinning face with smiling eyes">:grinning_face_with_smiling_eyes:</span></p>



<a name="184178219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184178219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184178219">(Dec 24 2019 at 16:36)</a>:</h4>
<p>File an issue and include the dummy project.</p>



<a name="184178238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184178238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184178238">(Dec 24 2019 at 16:36)</a>:</h4>
<p>You're talking about vscode or rust 1.39 vs 1.40? I don't think the rust version would make a difference.</p>



<a name="184178715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184178715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Martin Asquino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184178715">(Dec 24 2019 at 16:46)</a>:</h4>
<p>I'm on vim, and switching rust version causes that difference.</p>



<a name="184179281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/CodeLens%20Range/near/184179281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Martin Asquino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/CodeLens.20Range.html#184179281">(Dec 24 2019 at 17:01)</a>:</h4>
<p>Ok turns out it was not so much the rust version, but how I specified it. <code>rustup override set 1.40.0</code> and it works. <code>rustup override set stable</code> and it doesn't. I opened <a href="https://github.com/rust-analyzer/rust-analyzer/issues/2665" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/2665">https://github.com/rust-analyzer/rust-analyzer/issues/2665</a> and tried to explain that.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>